package com.lesales.dao.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.lesales.dao.interfaces.IAccountDao;
import com.lesales.model.User;

@Repository
public class AccountDaoImpl extends BaseDaoImpl<User, Serializable> implements IAccountDao {

	private List<User> userlist = new ArrayList<>();

	@Override
	public List<User> checkName(User user) {
		Map<String, Object> params = new HashMap<>();
		params.put("vcName", user.getUserName());
		String hql = "FROM User user WHERE user.userName= :vcName";
		userlist = find(hql, params);
		return userlist;
	}

	@Override
	public List<User> checkPassword(User user) {
		Map<String, Object> params = new HashMap<>();
		params.put("vcPassword", user.getPassword());
		String hql = "FROM User user WHERE user.password= :vcPassword";
		userlist = find(hql, params);
		return userlist;
	}

}
